#ifndef COMMONTREEDELEGATE_H
#define COMMONTREEDELEGATE_H

#include <QObject>
#include <QItemDelegate>

class CommonTreeDelegate : public QItemDelegate
{
    Q_OBJECT
public:
    explicit CommonTreeDelegate(QObject *parent = 0);
    virtual ~CommonTreeDelegate(){}

    /**
     * @brief setRowDisable 设置指定行不能够编辑
     * @param lstRow 行列表
     */
    void setRowDisable(QList<int> lstRow);

    /**
     * @brief setColDisable 设置指定列不能够编辑
     * @param lstCol 列列表
     */
    void setColDisable(QList<int> lstCol);



    // editing
    virtual QWidget *createEditor(QWidget *parent,
                                  const QStyleOptionViewItem &option,
                                  const QModelIndex &index) const;

    virtual void setEditorData(QWidget *widget, const QModelIndex &index) const;

    virtual void setModelData(QWidget *editor,
                              QAbstractItemModel *model,
                              const QModelIndex &index) const;

    virtual void updateEditorGeometry(QWidget *editor,
                                      const QStyleOptionViewItem &option,
                                      const QModelIndex &index) const;


signals:

public slots:

private:
    QList<int> mDisableRow;
    QList<int> mDisableCol;
};

#endif // COMMONTREEDELEGATE_H
